feat(planner): select summary-maintenance lifecycle plans - #318
Open
zzylol wants to merge 5 commits into
Open
Conversation
zzylol
force-pushed
the
fix/summary-lifecycle-legality
branch
from
August 30, 2026 18:21
9806c0a to
495b664
Compare
zzylol
force-pushed
the
feat/lifecycle-aware-selection
branch
from
August 30, 2026 18:21
51e1904 to
e716fed
Compare
zzylol
force-pushed
the
fix/summary-lifecycle-legality
branch
from
August 30, 2026 18:30
495b664 to
4015f26
Compare
zzylol
force-pushed
the
feat/lifecycle-aware-selection
branch
from
August 30, 2026 18:30
e716fed to
a18c539
Compare
zzylol
force-pushed
the
fix/summary-lifecycle-legality
branch
from
August 30, 2026 18:35
4015f26 to
944df5d
Compare
zzylol
force-pushed
the
feat/lifecycle-aware-selection
branch
from
August 30, 2026 18:35
a18c539 to
06a2099
Compare
zzylol
force-pushed
the
fix/summary-lifecycle-legality
branch
from
August 30, 2026 18:46
944df5d to
621fb5e
Compare
zzylol
force-pushed
the
feat/lifecycle-aware-selection
branch
from
August 30, 2026 18:46
06a2099 to
3293d37
Compare
zzylol
force-pushed
the
fix/summary-lifecycle-legality
branch
from
August 30, 2026 19:03
621fb5e to
5adb5f1
Compare
zzylol
force-pushed
the
feat/lifecycle-aware-selection
branch
from
August 30, 2026 19:03
3293d37 to
c8f7c0c
Compare
zzylol
force-pushed
the
fix/summary-lifecycle-legality
branch
from
August 30, 2026 21:22
5adb5f1 to
158002a
Compare
zzylol
force-pushed
the
feat/lifecycle-aware-selection
branch
from
August 30, 2026 21:22
c8f7c0c to
0613a90
Compare
zzylol
force-pushed
the
fix/summary-lifecycle-legality
branch
from
August 30, 2026 21:27
158002a to
3df3599
Compare
zzylol
force-pushed
the
feat/lifecycle-aware-selection
branch
from
August 30, 2026 21:27
0613a90 to
c517a1a
Compare
zzylol
force-pushed
the
fix/summary-lifecycle-legality
branch
from
August 31, 2026 12:04
3df3599 to
c9334fc
Compare
zzylol
force-pushed
the
feat/lifecycle-aware-selection
branch
2 times, most recently
from
August 31, 2026 12:17
bc90946 to
2cce2eb
Compare
zzylol
force-pushed
the
fix/summary-lifecycle-legality
branch
from
August 31, 2026 12:17
c9334fc to
5e564bd
Compare
zzylol
force-pushed
the
fix/summary-lifecycle-legality
branch
from
August 31, 2026 12:35
5e564bd to
8db7940
Compare
zzylol
force-pushed
the
feat/lifecycle-aware-selection
branch
2 times, most recently
from
August 31, 2026 12:45
b162a36 to
b031b7f
Compare
zzylol
force-pushed
the
fix/summary-lifecycle-legality
branch
from
August 31, 2026 12:45
8db7940 to
27296e7
Compare
zzylol
force-pushed
the
feat/lifecycle-aware-selection
branch
from
August 31, 2026 21:57
b031b7f to
d77479b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #317.
Why
Legal summary-maintenance alternatives must participate in candidate selection before a post-ASAP DAG is committed. The planner must account for both sides of demand:
Those quantities change whether rebuilding for every query, retaining shared state, continuously maintaining state, or evaluating the raw expression is cheapest.
Before this PR
The planner could enumerate lifecycle alternatives, but semantic summary candidates were still ranked without their complete build, update, read, retention, and retirement cost. The selected lifecycle and maintenance mode were not materialized as a physical guarantee.
After this PR
Every costable summary candidate receives a horizon-wide summary-maintenance cost before global selection. The selected post-ASAP DAG carries a
SummaryMaintenanceLifecycleGuarantee, and materialization can still choose rawKeepPreAsaprecomputation when it is no more expensive.Selection algorithm
Inputs are the existing
PlanSpace, the normalizedQueryWorkloadplus target-to-entry bindings, planning time, optional optimization horizon, runtime lifecycle capabilities, and the existingCostModel.PlanSpacepropagates effective uses through the DAG and derives aRecurrenceProfilefor each target. The lifecycle planner converts the bound workload entries into expected reads, one-time invocations, evaluation rate, fresh update rate, data arrival, and any valid prepared-state window.Replacement::Summarycandidate, collect each unique reachableSummaryAggonce byRcidentity.Ephemeral,Prepared,Shared, andContinuouslyMaintained. Reject alternatives that violate workload requirements, runtime lifecycle support, summary update/delete capabilities, horizon requirements, or evidence freshness.CostModelsupplies primitive build, per-update maintenance, read, retention-rate, and retirement costs. The planner combines them with expected reads, update rate, and retention duration:With
B = build,M = maintenance/update,Q = summary read,S = retention/second,X = retirement,R = expected reads,U = expected updates, andT = retained seconds, the implemented totals are:R * (B + Q + X);B + one_time_reads * Q + U * M + T * S + X;B + R * Q + U * M + T * S + X.For data at rest,
U * Mis zero. Missing inputs remain unknown; they are never interpreted as zero.EvaluationSchedule. For each connected component, compare the total cost under each schedule that every member supports, choose the cheapest common schedule, then choose each member's cheapest lifecycle under that schedule.CandidateCostOverridesentry.PlanSpace::global_selection_with_candidate_costsuses the cheapest lifecycle-aware summary candidate for that memo group while retaining its existing topological effective-use propagation.SummaryMaintenanceMode, evaluation schedule, and output representation to each deployment.raw_query_recompute_cost * expected_readsis compared with the selected summary deployment total. A known raw cost wins ties and replaces the target withKeepPreAsap.How this composes with the existing cost planner
This is an additional physical-cost stage, not a replacement cost system:
CostModel.RecurrenceProfiledocumentation inrecurrence.rs, and the selection code inPlanSpace::global_selection_with_recurrenceanddecide_group_with_recurrence.CandidateCostOverrides.estimate_cost/CSE ranking path. Within a lifecycle-ranked group, uncosted candidates cannot beat known totals; unknown evidence never becomes an artificial zero.Therefore the flow is:
candidate legality and sizing -> recurrence/effective-use analysis -> lifecycle-aware candidate totals -> global PlanSpace selection -> physical lifecycle guarantee -> raw recomputation fallback.Verification
cargo test -p asap-aware-mapping summary_maintenance_lifecycle --no-fail-fastcargo clippy -p asap-aware-mapping --all-targets -- -D warningsStack
Base: #317. Next: #319.